<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>sock: sock::net::EventLoop Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">sock
   &#160;<span id="projectnumber">v0.11</span>
   </div>
   <div id="projectbrief">C++ Network Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacesock.html">sock</a></li><li class="navelem"><a class="el" href="namespacesock_1_1net.html">net</a></li><li class="navelem"><a class="el" href="classsock_1_1net_1_1_event_loop.html">EventLoop</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsock_1_1net_1_1_event_loop-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">sock::net::EventLoop Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>事件循环  
 <a href="classsock_1_1net_1_1_event_loop.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="event__loop_8h_source.html">event_loop.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sock::net::EventLoop:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classsock_1_1net_1_1_event_loop.png" usemap="#sock::net::EventLoop_map" alt=""/>
  <map id="sock::net::EventLoop_map" name="sock::net::EventLoop_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsock_1_1net_1_1_event_loop_1_1_statics.html">Statics</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">状态  <a href="structsock_1_1net_1_1_event_loop_1_1_statics.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ab28d6bf1c548153366f543d2609b1d88"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88">State</a> { <a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88aff92513eda03d0bee067d93b99688b0f">READY</a>, 
<a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88a8cc318f0008034a401cf529e3c299e5b">RUNNING</a>, 
<a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88a0aad4d1bdc7231fe13e2e4a99aa58312">EXITING</a>, 
<a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88a225dce8b187e8f43cb56c45c6f0a9641">EXIT</a>
 }<tr class="memdesc:ab28d6bf1c548153366f543d2609b1d88"><td class="mdescLeft">&#160;</td><td class="mdescRight">状态  <a href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88">More...</a><br /></td></tr>
<tr class="separator:ab28d6bf1c548153366f543d2609b1d88"><td class="memSeparator" colspan="2">&#160;</td></tr>
</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a331c5606120916c4b979e09cdad08b68"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a331c5606120916c4b979e09cdad08b68">EventLoop</a> (int id=-1)</td></tr>
<tr class="separator:a331c5606120916c4b979e09cdad08b68"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b6e605d5352b92fa0d5b55682179162"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a8b6e605d5352b92fa0d5b55682179162">~EventLoop</a> (void)</td></tr>
<tr class="separator:a8b6e605d5352b92fa0d5b55682179162"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a79368440ea6f81c4c2f2bfe31c1975fb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a79368440ea6f81c4c2f2bfe31c1975fb">queue</a> (boost::function&lt; void(void)&gt; handler)</td></tr>
<tr class="separator:a79368440ea6f81c4c2f2bfe31c1975fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c3528af20401c5bcaa7c8ddfe831d2d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a2c3528af20401c5bcaa7c8ddfe831d2d">run</a> (void)</td></tr>
<tr class="memdesc:a2c3528af20401c5bcaa7c8ddfe831d2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">执行循环  <a href="#a2c3528af20401c5bcaa7c8ddfe831d2d">More...</a><br /></td></tr>
<tr class="separator:a2c3528af20401c5bcaa7c8ddfe831d2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2115323b7b33ddab22e986c64c2741a8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a2115323b7b33ddab22e986c64c2741a8">stop</a> (void)</td></tr>
<tr class="memdesc:a2115323b7b33ddab22e986c64c2741a8"><td class="mdescLeft">&#160;</td><td class="mdescRight">停止循环  <a href="#a2115323b7b33ddab22e986c64c2741a8">More...</a><br /></td></tr>
<tr class="separator:a2115323b7b33ddab22e986c64c2741a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f46094758e91bfc921609f5c9c70100"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structsock_1_1net_1_1_event_loop_1_1_statics.html">Statics</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a4f46094758e91bfc921609f5c9c70100">getStatics</a> (void)</td></tr>
<tr class="memdesc:a4f46094758e91bfc921609f5c9c70100"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取循环状态  <a href="#a4f46094758e91bfc921609f5c9c70100">More...</a><br /></td></tr>
<tr class="separator:a4f46094758e91bfc921609f5c9c70100"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97b81fbb8899340ab54f8a6240964925"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a97b81fbb8899340ab54f8a6240964925">getId</a> (void) const </td></tr>
<tr class="memdesc:a97b81fbb8899340ab54f8a6240964925"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取循环ID  <a href="#a97b81fbb8899340ab54f8a6240964925">More...</a><br /></td></tr>
<tr class="separator:a97b81fbb8899340ab54f8a6240964925"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a388a74d15d9d5d8b7b4cf52fb07678f6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a388a74d15d9d5d8b7b4cf52fb07678f6">setFrameTime</a> (base::mtime_t time)</td></tr>
<tr class="memdesc:a388a74d15d9d5d8b7b4cf52fb07678f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置帧时间  <a href="#a388a74d15d9d5d8b7b4cf52fb07678f6">More...</a><br /></td></tr>
<tr class="separator:a388a74d15d9d5d8b7b4cf52fb07678f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f3092aa884148977206a30fc13d1385"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespacesock_1_1net.html#af8e0f3d2c4f0c2125945c1db54739b23">ReactorPtr</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsock_1_1net_1_1_event_loop.html#a0f3092aa884148977206a30fc13d1385">getReactor</a> (void)</td></tr>
<tr class="memdesc:a0f3092aa884148977206a30fc13d1385"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取循环的网络反应器  <a href="#a0f3092aa884148977206a30fc13d1385">More...</a><br /></td></tr>
<tr class="separator:a0f3092aa884148977206a30fc13d1385"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>事件循环 </p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="ab28d6bf1c548153366f543d2609b1d88"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classsock_1_1net_1_1_event_loop.html#ab28d6bf1c548153366f543d2609b1d88">sock::net::EventLoop::State</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>状态 </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ab28d6bf1c548153366f543d2609b1d88aff92513eda03d0bee067d93b99688b0f"></a>READY&#160;</td><td class="fielddoc">
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ab28d6bf1c548153366f543d2609b1d88a8cc318f0008034a401cf529e3c299e5b"></a>RUNNING&#160;</td><td class="fielddoc">
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ab28d6bf1c548153366f543d2609b1d88a0aad4d1bdc7231fe13e2e4a99aa58312"></a>EXITING&#160;</td><td class="fielddoc">
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ab28d6bf1c548153366f543d2609b1d88a225dce8b187e8f43cb56c45c6f0a9641"></a>EXIT&#160;</td><td class="fielddoc">
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a331c5606120916c4b979e09cdad08b68"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">EventLoop::EventLoop </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>id</em> = <code>-1</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a class="anchor" id="a8b6e605d5352b92fa0d5b55682179162"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">EventLoop::~EventLoop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a97b81fbb8899340ab54f8a6240964925"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int sock::net::EventLoop::getId </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取循环ID </p>

</div>
</div>
<a class="anchor" id="a0f3092aa884148977206a30fc13d1385"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespacesock_1_1net.html#af8e0f3d2c4f0c2125945c1db54739b23">ReactorPtr</a>&amp; sock::net::EventLoop::getReactor </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取循环的网络反应器 </p>
<dl class="section return"><dt>Returns</dt><dd>ReactorPtr&amp; </dd></dl>

</div>
</div>
<a class="anchor" id="a4f46094758e91bfc921609f5c9c70100"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structsock_1_1net_1_1_event_loop_1_1_statics.html">Statics</a> sock::net::EventLoop::getStatics </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取循环状态 </p>

</div>
</div>
<a class="anchor" id="a79368440ea6f81c4c2f2bfe31c1975fb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EventLoop::queue </td>
          <td>(</td>
          <td class="paramtype">boost::function&lt; void(void)&gt;&#160;</td>
          <td class="paramname"><em>handler</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>向事件循环添加一个事件 </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">handler</td><td>回调函数 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a2c3528af20401c5bcaa7c8ddfe831d2d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EventLoop::run </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>执行循环 </p>

</div>
</div>
<a class="anchor" id="a388a74d15d9d5d8b7b4cf52fb07678f6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void sock::net::EventLoop::setFrameTime </td>
          <td>(</td>
          <td class="paramtype">base::mtime_t&#160;</td>
          <td class="paramname"><em>time</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置帧时间 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">time</td><td>帧时间 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a2115323b7b33ddab22e986c64c2741a8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EventLoop::stop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>停止循环 </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>E:/git/sock/sock/net/<a class="el" href="event__loop_8h_source.html">event_loop.h</a></li>
<li>E:/git/sock/src/net/<a class="el" href="event__loop_8cc.html">event_loop.cc</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
